package com.ruoyi.know.service.impl;

import java.util.List;

import com.ruoyi.know.domain.Courses;
import com.ruoyi.know.mapper.CoursesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.know.mapper.CourseChaptersMapper;
import com.ruoyi.know.domain.CourseChapters;
import com.ruoyi.know.service.ICourseChaptersService;

/**
 * 课程章节Service业务层处理
 *
 * @author ruoyi
 * @date 2025-01-26
 */
@Service
public class CourseChaptersServiceImpl implements ICourseChaptersService
{
    @Autowired
    private CourseChaptersMapper courseChaptersMapper;
    @Autowired
    private CoursesMapper coursesMapper;

    /**
     * 查询课程章节
     *
     * @param chapterId 课程章节主键
     * @return 课程章节
     */
    @Override
    public CourseChapters selectCourseChaptersByChapterId(Long chapterId)
    {
        return courseChaptersMapper.selectCourseChaptersByChapterId(chapterId);
    }

    /**
     * 查询课程章节列表
     *
     * @param courseChapters 课程章节
     * @return 课程章节
     */
    @Override
    public List<CourseChapters> selectCourseChaptersList(CourseChapters courseChapters)
    {
        return courseChaptersMapper.selectCourseChaptersList(courseChapters);
    }

    /**
     * 新增课程章节
     *
     * @param courseChapters 课程章节
     * @return 结果
     */
    @Override
    public int insertCourseChapters(CourseChapters courseChapters)
    {
        return courseChaptersMapper.insertCourseChapters(courseChapters);
    }

    /**
     * 修改课程章节
     *
     * @param courseChapters 课程章节
     * @return 结果
     */
    @Override
    public int updateCourseChapters(CourseChapters courseChapters)
    {
        return courseChaptersMapper.updateCourseChapters(courseChapters);
    }

    /**
     * 批量删除课程章节
     *
     * @param chapterIds 需要删除的课程章节主键
     * @return 结果
     */
    @Override
    public int deleteCourseChaptersByChapterIds(Long[] chapterIds)
    {
        return courseChaptersMapper.deleteCourseChaptersByChapterIds(chapterIds);
    }

    /**
     * 删除课程章节信息
     *
     * @param chapterId 课程章节主键
     * @return 结果
     */
    @Override
    public int deleteCourseChaptersByChapterId(Long chapterId)
    {
        return courseChaptersMapper.deleteCourseChaptersByChapterId(chapterId);
    }
}
